package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.ShopCatClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.shop.dos.ShopCatDO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 *店铺分组相关熔断 fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:27
 **/
@Component
public class ShopCatClientFallbackFactory extends BaseFallbackFactory<ShopCatClientFeignImpl> {
    @Override
    protected ShopCatClientFeignImpl fallback() {
        return new ShopCatClientFallback();
    }

    /**
     * 店铺分组相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午4:27
     * @since v7.0
     */
    @Component
    public static class ShopCatClientFallback implements ShopCatClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public List getChildren(String catPath) {
            logger.error("当前分组所有的子错误");
            return null;
        }

        @Override
        public ShopCatDO getModel(Long id) {
            logger.error("获取ID为" + id + "的分组错误");
            return null;
        }
    }
}
